package com.woniuxy.controller;

import com.woniuxy.entity.DriverManagement;
import com.woniuxy.entity.dto.PartnerDTO;
import com.woniuxy.mapper.DriverManagementMapper;
import com.woniuxy.service.DriverManagementService;
import com.woniuxy.util.PageData;
import com.woniuxy.util.ResponseData;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.text.ParseException;
import java.util.List;

@RestController
@RequestMapping("/driver")
public class DriverManagementController {
    @Resource
    private DriverManagementService driverManagementService;
    @PostMapping("/queryAllDriver")
    public ResponseData<?> queryAllDriver(@RequestBody PageData<DriverManagement> pageData) {
       return driverManagementService.queryAllPartner(pageData);
    }

    @PostMapping("/addDriverBtn")
    public ResponseData<?> addDriverBtn(@RequestBody DriverManagement driverManagement) throws ParseException {
        return driverManagementService.addDriver(driverManagement);
    }

    @PostMapping("/saveUpdateDriver")
    public ResponseData<?> saveUpdateDriver(@RequestBody DriverManagement driverManagement) throws ParseException {
        return driverManagementService.updateDriver(driverManagement);
    }

    @PostMapping("/updateDriverStatus")
    public ResponseData<?> updateDriverStatus(@RequestBody DriverManagement driverManagement){
        return driverManagementService.updateDriverStatus(driverManagement);
    }

    @PostMapping("/batchUpdateStatus1")
    public ResponseData<?> batchUpdateStatus1(@RequestBody List<DriverManagement> driverManagements){
        return driverManagementService.batchUpdateStatus1(driverManagements);
    }

    @PostMapping("/batchUpdateStatus0")
    public ResponseData<?> batchUpdateStatus0(@RequestBody List<DriverManagement> driverManagements){
        return driverManagementService.batchUpdateStatus0(driverManagements);
    }
}
